# Contributor: Duncan Bellamy <dunk@denkimushi.com>
# Maintainer: Duncan Bellamy <dunk@denkimushi.com>
pkgname=asuran-cli
pkgver=0.1.6
pkgrel=6
pkgdesc="Asuran is a new archive format and rust implementation"
url="https://gitlab.com/asuran-rs/asuran"
arch="all !s390x !riscv64"
license="BSD-2-Clause-Patent"
options="net"
makedepends="
	cargo
	cargo-auditable
	libssh2-dev
	openssl-dev
	xz-dev
	zstd-dev
	"
source="https://gitlab.com/asuran-rs/asuran/-/archive/v$pkgver/asuran-v$pkgver.tar.gz
	openssl3.patch
	new-rust.patch
	system-zstd.patch
	libc.patch
	"
builddir="$srcdir/asuran-v$pkgver"

export LIBSSH2_SYS_USE_PKG_CONFIG=1

prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
}

build() {
	case "$CARCH" in
	aarch64)
		local features="--features blake3-neon"
		;;
	esac

	cargo auditable build --release --frozen $features --package asuran-cli
}

check() {
	cargo test --frozen --package asuran-cli
}

package() {
	install -Dm755 target/release/asuran-cli -t "$pkgdir"/usr/bin/
}

sha512sums="
2345b9ad0daedc4b21707bcdae72f7678f8e8d7adb470f78088ceb88f8ca18d1661bc5126d6199d5e904b528c7b5b50e9f8c3d770b28b72fcad64c17e9b87add  asuran-v0.1.6.tar.gz
d2a9d1415bf7caf95448d3068298d162359c76b27faf5ea2c62c7da9854f536bdcc7f0a3eabe95474a5f11926109978ba47a2b1aaf2dfa5d8d529c8e535457e0  openssl3.patch
4b60c0928c7485436031cf933888cf2dfc9ce7c7f13b93b0845d2b6867a5be49a3ae18892c89c2e84a346c6c351e659c678dfda6683ea4547c738d30da669e3d  new-rust.patch
7eef6f1a720c86705ee2fc0606ead13a1b7619ac0550a2783d1a480ab3c84c6d194ba9b51907f3ab203f43f34c2a8382d2d5067ec0da8ee7671ac75aac34cab1  system-zstd.patch
c512916af415c89f9fa7f1d971eee199679e2258af630e75398575c4a2e23002a7c3b3867f1f15470c36453396fdc3952adfcae0ce3f6c1de99586be0354eb4e  libc.patch
"
